(Review:) What two things does the following statement do?

String zeta = new String("The last rose of summer." );

A good answer might be:

  1. A new String object is created, containing the indicated characters.
  2. A reference to the object is saved in the variable zeta.

Easy way to Construct Strings

String objects are very useful and are frequently used. To make life easier for programmers, Java has a short-cut way of creating a String object, as follows:

String zeta = "The last rose of summer." ;

This creates a String object containing the characters between quote marks, just as before. Java also does something to optimize performance, but ignore this for now. A String created in this short-cut way is called a String literal. Most classes do not have a short-cut like this. Most other objects are constructed by using the new operator.

QUESTION 2:

Can a String be a parameter for a method?